<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
	<script type="text/javascript" src="./ajax.js"></script>
	<script type="text/javascript">

		/*
			method:请求方式 get post
			url: 请求地址
			params：接口传参
			token: token
			success:成功的函数
			ContentType:请求头数据格式

		*/

		// ajax("get", "https://geoapi.qweather.com/v2/city/lookup",{
		// 	location="青岛"
		// 	key="c494e264764449f7b4f6bf742276d7f9"
		// }, false, function(res) {
		// 	console.log(res)
		// })
		ajax({
			method:"post",
			url:"http://wish.byesame.com/login",
			params: {
				userName:"admin",
				passWord:"123456"
			},
			ContentType:"application/x-www-form-urlencoded",
			success: function(res) {
				console.log(res)
				localStorage.setItem("token", res.data.token)
			}
		})

		function list() {
			ajax({
				method: "get",
				url: "http://wish.byesame.com/admin",
				params: {
					page: 1,
					rows: 10
				},
				token: localStorage.getItem("token"),
				success: function(res) {
					console.log(res)
				}
			})
		}
		list()
	</script>
</body>
</html>